/*
 * @Author: 飞越疯人院 353362604@qq.com
 * @Date: 2022-12-07 15:02:59
 * @LastEditors: 飞越疯人院 353362604@qq.com
 * @LastEditTime: 2022-12-07 19:20:58
 * @FilePath: \adminstration\src\Common\Modal\TwoModalList\ProjectSchedule.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { API_LIST } from '../../Api/Api'
import { BuiltInData } from '../config'
import { TwoAddBtn, ThrDeleteBtn } from '../options'

export const ProjectSchedule = async ({ upDataEvent, data, Permission }) => {
    let dataList = {
        type: '项目阶段设置',
        hideInSearch: true,
        pageSize: 10,
        params: { OrderField: 'projectScheduleType@asc' },
        classification: 'TableModal',
        get: API_LIST()['getProjectSchedule'],
        additional: { key: 'organizationUuid', value: 'uuid' },
        options: [
            Permission.findIndex(v => v.uuid === '32d7ed58-a922-44aa-8fde-aeb5ecdae041') !== -1 && (
                <TwoAddBtn
                    upDataEvent={upDataEvent}
                    title="添加阶段信息"
                    ThrKey="ThrModal"
                    value="ProjectSchedule"
                    data={data}
                />
            ),
        ],
        columns: [
            {
                dataIndex: 'projectScheduleType',
                title: '项目阶段',
                valueType: 'select',
                valueEnum: BuiltInData.projectScheduleType,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'startMonth',
                title: '开始时间',
                valueType: 'Date',
                showTime: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'endMonth',
                title: '结束时间',
                valueType: 'Date',
                showTime: true,
                rules: true,
                width: 150,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '3c463a09-f02c-479f-a32d-d58b678a9bf6') !== -1 && (
                            <ThrDeleteBtn
                                key="delete"
                                record={record.uuid}
                                upDataEvent={upDataEvent}
                                data={{ key: 'delete', url: 'delProjectSchedule', title: '删除阶段数据' }}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
